extends Node2D

@onready var tube_top: StaticBody2D = $TubeTop
@onready var tube_bottom: StaticBody2D = $TubeBottom
@onready var free_timer: Timer = $FreeTimer


func _ready() -> void:
	scale.x = 0.25
	var min_space: int = 160 #最小空隙
	var top_move = randi_range(300, 800) #顶部管道移动的距离
	tube_top.global_position.y -= top_move
	tube_bottom.global_position.y += 1080 - top_move + min_space + randi_range(0, 280)



func _on_point_area_body_exited(body: Node2D) -> void:
	free_timer.start()
	if "get_award" in body:
		body.get_award({"point": 1})




func _on_free_timer_timeout() -> void:
	queue_free()
